﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Resehantering
{
    public partial class skriv_ut : System.Web.UI.Page
    {
        public string data { get; set; } //variabel att skriva i

        protected void Page_Load(object sender, EventArgs e)
        {
            ServiceReference1.Service1Client wcfClient = new ServiceReference1.Service1Client();
            string userName = User.Identity.Name;
            if (userName.Equals(""))
                userName = "John Doe";
            List<Resa> resor = wcfClient.GetResorByUser(userName);

            if (resor.Count > 0)
            {
                Resa resa = resor[resor.Count - 1];  //plocka ut det sista i listan

                int id = resa.ResaID;
                string anstalld = resa.Anstalld;
                string land = resa.Land;
                string anledning = resa.Anledning;
                string inut = resa.InrikesUtrikes;
                int semester = resa.SemesterDagar;
                DateTime start = resa.StartDatum;
                DateTime slut = resa.SlutDatum;
                Boolean sverige = resa.SverigeStart;
                Boolean godkand = resa.Godkand;
                double traktamente = resa.Traktamente;

                data = "<h1>MIN SENASTE RESA</h1>" +
                    "<p><b>RESEID</b> " + id + "<br />" +
                    "<b>ANSTÄLLD</b> " + anstalld + "<br />" +
                    "<b>LAND</b> " + land + "<br />" +
                    "<b>RESER</b> " + inut + "<br />" +
                    "<b>STARTAR RESAN</b> " + start + "<br />" +
                    "<b>SLUTAR RESAN</b> " + slut + "<br />" +
                    "<b>SEMESTER</b> " + semester + "<br />" +
                    "<b>ANLEDNING</b> " + anledning + "<br />" +
                    "<b>GODKÄND</b> " + godkand + "<br />" +
                    "<b>TRAKTAMENTE</b> " + traktamente + "</p>";
            }
        }
    }
}